# -*- coding: utf-8 -*-
# standard
import os
import sys
import threading

# third

# local
_P_PATH =  os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
if _P_PATH not in sys.path:
    sys.path.append(_P_PATH)
from db.sqlalchemy_dbc import init_db_by_async
from models.base_model import *



"""
@Title:   
@File: __init__.py
@Author: walle 2025年05日16日 15时52分24秒
@Version: 1.0.0
@Desc: 
"""



async def init_resources():
    """
    初始化资源
    """
    await init_db_by_async()


async def cleanup_resources():
    """
    清理资源
    """
    pass


def init_db_default_values():
    """
    创建数据库的默认值
    必须在数据库映射以后执行
    """
    ...
    logger.info("数据库默认值初始化完成")


def start_init_default_thread(delay: int = 10):
    """
    启动数据库默认值初始化
    :param delay: _description_, defaults to 10
    """
    timer = threading.Timer(delay, init_db_default_values)
    timer.start()


if __name__ == '__main__':
    init_db_by_sync()
    pass